<template>
  <div>
    <h2>{{ n }}</h2>
    <h3>{{ count }}</h3>
    <button @click="add">按钮</button>
    <button @click="sub">按钮</button>
    <button @click="eventAdd">按钮</button>
    <button @click="AsyncAdd">按钮</button>
    <button @click="ADD(2)">按钮</button>
  </div>
</template>
    
<script>
import { mapState, mapActions, mapGetters, mapMutations } from "vuex";
export default {
  name: "VueDemoIndex",
  computed: {
    ...mapState(["n"]),
    ...mapGetters(["count"]),
  },
  methods: {
    ...mapActions(["add", "sub", "AsyncAdd", "eventAdd"]),
    add1() {
      this.$store.commit("ADD");
    },
    ...mapMutations(["ADD"]),
  },
  created() {
    console.log(this);
  },
};
</script>

<style lang="scss" scoped>
</style>